package history

func extraNum(s string) []int {
	// write code here
	var left = 0
	var res []int
	for left < len(s) {
		if s[left] >= '0' && s[left] <= '9' {
			var curRight = left + 1
			for curRight < len(s) && s[curRight] >= '0' && s[curRight] <= '9' {
				curRight++
			}
			var curVal = 0
			for i := left; i < curRight; i++ {
				curVal = curVal*10 + int(s[i]-'0')
			}
			res = append(res, curVal)
			left = curRight
		} else {
			left++
		}
	}
	return res
}
